package com.dujiawei;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SpringJwtDemoApplication {

    /**
     * 测试步骤：
     * 1、curl -H "Content-Type: application/json" -X POST -d '{"username":"admin","password":"123456"}'  http://127.0.0.1:8080/login
     *   拿到传入JSON，解析用户名密码 - JWTLoginFilter 类 attemptAuthentication 方法
     *   自定义身份认证验证组件，进行身份认证 - CustomAuthenticationProvider 类 authenticate 方法
     *   验证成功 - JWTLoginFilter 类 successfulAuthentication 方法
     *   生成JWT - TokenAuthenticationService 类 addAuthentication方法
     *   {
     *     "result": "eyJhbGciOiJIUzUxMiJ9.eyJhdXRob3JpdGllcyI6IlJPTEVfQURNSU4sQVVUSF9XUklURSIsInN1YiI6ImFkbWluIiwiZXhwIjoxNjI0MzMxMzE2fQ.Pxec9rqN2T3dBU1bt9JdmYLE7hy5sMKC1utFwUMiuFLolIbGRlIEfOmaEs5-PpywSdnrrUScVyfc5wk9UJSiGA",
     *     "message": "",
     *     "status": 0
     *   }
     *
     * 2、curl -H "Content-Type: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJhdXRob3JpdGllcyI6IlJPTEVfQURNSU4sQVVUSF9XUklURSIsInN1YiI6ImFkbWluIiwiZXhwIjoxNjI0MzMxMzE2fQ.Pxec9rqN2T3dBU1bt9JdmYLE7hy5sMKC1utFwUMiuFLolIbGRlIEfOmaEs5-PpywSdnrrUScVyfc5wk9UJSiGA"  http://127.0.0.1:8080/users
     *
     * {
     *     "result": [
     *         "xiaobai",
     *         "xiaoya",
     *         "xiaotu"
     *     ],
     *     "message": "",
     *     "status": 0
     * }
     * @param args
     */
    public static void main(String[] args) {
        SpringApplication.run(SpringJwtDemoApplication.class, args);
    }

}
